package com.bs.blogspace.mapper;

import com.bs.blogspace.pojo.Like;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface LikeMapper {
    // 查询点赞用户信息
    @Select("select l_phone, l_username, l_avatar from `like` where essay_id = #{essayId}")
    List<Like> likeSelect(Integer essayId);
    // 插入点赞用户数据
    @Insert("insert into `like` (essay_id,L_phone,L_username,L_avatar,create_time,update_time) values(#{essayId},#{Lphone},#{LuserName},#{Lavatar},now(),now())")
    int addLike(Like like);
    //删除点赞
    @Delete("delete from  `like` where L_phone=#{Lphone} and essay_id=#{essayId}")
    int delete(Like like);

}
